import Mock from 'mockjs'
const list = Mock.mock({
  'list|10': [
    {
      smsId: '@id',
      title: '@csentence',
      content: '@csentence(100)',
      smsCode: '@integer',
      sendUserName: '@cname',
      sendDate: '@date',
      'smsType|1': [1, 2],
      'sendMode|1': [1, 2],
      userName: '@cname',
      userTel: '@integer(11)',
      'status|1': [1, 2]
    }
  ]
})
const dictMap = {
  sendMode: {
    2: '111',
    1: '222'
  },
  smsType: {
    1: 'eee',
    2: '3rrr'
  },
  status: {
    2: '222',
    1: 'dddd'
  }
}
const pub = {
  isMore: 0,
  pageIndex: 1,
  pageSize: 10,
  startIndex: 0,
  totalNum: 30,
  totalPage: 1
}

const model = Mock.mock({
  'list|10': [
    {
      smsTemplateId: '@id',
      smsCode: '@string',
      smsContent: '@string',
      smsTitle: '@csentence',
      'smsType|1': [1, 2]
    }
  ]
})
export default [
  // 短信
  // 分页查询短信
  {
    url: '/general/sms/listSmsByPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 分页查询短信接收列表
  {
    url: '/general/sms/listSmsUserByPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...list,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 发送短信
  {
    url: '/general/sms/sendSms',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  // 根据ID查询短信
  {
    url: '/general/sms/viewSmsById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: list.list[0],
        msg: ''
      }
    }
  },
  // 短信模板
  // 添加短信模板
  {
    url: '/general/sms/addSmsTemplate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: { ...model },
        msg: ''
      }
    }
  },
  // 根据ID删除短信模板
  {
    url: '/general/sms/deleteSmsTemplateById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: model.list[0],
        msg: ''
      }
    }
  },
  // 短信模板分页查询
  {
    url: '/general/sms/listSmsTemplateByPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...model,
          ...pub
        },
        dictMap,
        msg: ''
      }
    }
  },
  // 设置短信模板类型
  {
    url: '/general/sms/setSmsTemplateType',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: { ...model },
        msg: ''
      }
    }
  },
  // 根据短信模板ID查询
  {
    url: '/general/sms/viewSmsTemplateById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: model.list[0],
        msg: ''
      }
    }
  }
]

// export default [

// ]
